def pon(a):
    c = []
    for i in range(len(a)):
        if a[i] == "(" or a[i] == "[" or a[i] == "{":
            c.append(a[i])
        else:
            if len(c) == 0:
                return False
            if a[i] == "}" and c[-1] == "{":
                c.pop()
            elif a[i] == ")" and c[-1] == "(":    
                c.pop()
            elif a[i] == "]" and c[-1] == "[":  
                c.pop()
            elif a[i] == ">" and c[-1] == "<":  
                c.pop()   
            else:
                return False  
    if len(c) > 0:
        return False
    return True
print(pon(input("введите скобочную последовательность:")))
